﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.Linq;
using System.Xml.Linq;


namespace Nok_Air.NokObjects
{
    public class MainViewModel : INotifyPropertyChanged
    {
        public MainViewModel()
        {
            this.MenuItem = new ObservableCollection<NokObjects.MenuItemViewModel>();
            this.AirportItems = new ObservableCollection<NokObjects.AirportItem>();
            this.AvailableAirportItemsSrc = new ObservableCollection<NokObjects.AirportItem>();
            this.AvailableAirportItemsDest = new ObservableCollection<NokObjects.AirportItem>();
            this.ScheduleItems = new ObservableCollection<NokObjects.ScheduleItemViewModel>();
            this.BookingItems = new NokObjects.BookingItemViewModel();
            this.IsFinishTransaction = false;
            this.GetPassengersResult = new NokObjects.GetPassengersResultViewModel();
            this.GetSeatsResult = new NokObjects.GetSeatsResultViewModel();
        }
        #region List
        /// <summary>
        /// A collection for ItemViewModel objects. 
        /// </summary>
        public ObservableCollection<NokObjects.MenuItemViewModel> MenuItem { get; private set; }
        public ObservableCollection<NokObjects.AirportItem> AirportItems { get; private set; }
        private ObservableCollection<NokObjects.AirportItem> _availableAirportItemsSrc;
        public ObservableCollection<NokObjects.AirportItem> AvailableAirportItemsSrc
        {
            get
            {
                return _availableAirportItemsSrc;
            }
            set
            {
                if (value != _availableAirportItemsSrc)
                {
                    _availableAirportItemsSrc = value;
                    NotifyPropertyChanged("AvailableAirportItemsSrc");
                }
            }
        }    
        private ObservableCollection<NokObjects.AirportItem> _availableAirportItemsDest;
        public ObservableCollection<NokObjects.AirportItem> AvailableAirportItemsDest
        {
            get
            {
                return _availableAirportItemsDest;
            }
            set
            {
                if (value != _availableAirportItemsDest)
                {
                    _availableAirportItemsDest = value;
                    NotifyPropertyChanged("AvailableAirportItemsDest");
                }
            }
        }
        private ObservableCollection<NokObjects.ScheduleItemViewModel> _scheduleItems;
        public ObservableCollection<NokObjects.ScheduleItemViewModel> ScheduleItems
        {
            get
            {
                return _scheduleItems;
            }
            set
            {
                if (value != _scheduleItems)
                {
                    _scheduleItems = value;
                    NotifyPropertyChanged("ScheduleItems");
                }
            }
        }

        private bool _isFinishTransaction;
        public bool IsFinishTransaction
        {
            get
            {
                return _isFinishTransaction;
            }
            set
            {
                if (value != _isFinishTransaction)
                {
                    _isFinishTransaction = value;
                    NotifyPropertyChanged("IsFinishTransaction");
                }
            }
        }

        private ObservableCollection<FlightSegmentItemViewModel> _FlightSegmentItems;
        public ObservableCollection<FlightSegmentItemViewModel> FlightSegmentItems
        {
            get
            {
                return _FlightSegmentItems;
            }
            set
            {
                if (value != _FlightSegmentItems)
                {
                    _FlightSegmentItems = value;
                    NotifyPropertyChanged("FlightSegmentItems");
                }
            }
        }
        private ObservableCollection<AvailabilityItemViewModel> _AvailabilityItems;
        public ObservableCollection<AvailabilityItemViewModel> AvailabilityItems
        {
            get
            {
                return _AvailabilityItems;
            }
            set
            {
                if (value != _AvailabilityItems)
                {
                    _AvailabilityItems = value;
                    NotifyPropertyChanged("AvailabilityItems");
                }
            }
        }
        private NokObjects.PricingV2ItemViewModel _PricingV2Items;
        public NokObjects.PricingV2ItemViewModel PricingV2Items
        {
            get
            {
                return _PricingV2Items;
            }
            set
            {
                if (value != _PricingV2Items)
                {
                    _PricingV2Items = value;
                    NotifyPropertyChanged("PricingV2Items");
                }
            }
        }

        private ObservableCollection<NokAirWS.Fee> _feeItem;
        public ObservableCollection<NokAirWS.Fee> FeeItem
        {
            get
            {
                return _feeItem;
            }
            set
            {
                if (value != _feeItem)
                {
                    _feeItem = value;
                    NotifyPropertyChanged("FeeItem");
                }
            }
        }
        private ObservableCollection<string> _ReqisterPaymentChannelResult;
        public ObservableCollection<string> ReqisterPaymentChannelResult
        {
            get
            {
                return _ReqisterPaymentChannelResult;
            }
            set
            {
                if (value != _ReqisterPaymentChannelResult)
                {
                    _ReqisterPaymentChannelResult = value;
                    NotifyPropertyChanged("ReqisterPaymentChannelResult");
                }
            }
        }
        private string _SubmitBookingV2Result;
        public string SubmitBookingV2Result
        {
            get
            {
                return _SubmitBookingV2Result;
            }
            set
            {
                if (value != _SubmitBookingV2Result)
                {
                    _SubmitBookingV2Result = value;
                    NotifyPropertyChanged("SubmitBookingV2Result");
                }
            }
        }
        private NokObjects.BookingItemViewModel _bookingItems;
        public NokObjects.BookingItemViewModel BookingItems
        {
            get
            {
                return _bookingItems;
            }
            set
            {
                if (value != _bookingItems)
                {
                    _bookingItems = value;
                    NotifyPropertyChanged("BookingItems");
                }
            }
        }
        private NokObjects.PassengerItemViewModel _PassengerItem;
        public NokObjects.PassengerItemViewModel PassengerItem
        {
            get
            {
                return _PassengerItem;
            }
            set
            {
                if (value != _PassengerItem)
                {
                    _PassengerItem = value;
                    NotifyPropertyChanged("PassengerItem");
                }
            }
        }

        private NokObjects.SubmitBookingStatus _SubmitBookingStatus;
        public NokObjects.SubmitBookingStatus SubmitBookingStatus
        {
            get
            {
                return _SubmitBookingStatus;
            }
            set
            {
                if (value != _SubmitBookingStatus)
                {
                    _SubmitBookingStatus = value;
                    NotifyPropertyChanged("ViewModels.SubmitBookingStatus");
                }
            }
        }

        private string _WithinMsg;
        public string WithinMsg
        {
            get
            {
                return _WithinMsg;
            }
            set
            {
                if (value != _WithinMsg)
                {
                    _WithinMsg = value;
                    NotifyPropertyChanged("WithinMsg");
                }
            }
        }

        private NokObjects.GetPassengersResultViewModel _GetPassengersResult;
        public NokObjects.GetPassengersResultViewModel GetPassengersResult
        {
            get
            {
                return _GetPassengersResult;
            }
            set
            {
                if (value != _GetPassengersResult)
                {
                    _GetPassengersResult = value;
                    NotifyPropertyChanged("GetPassengersResult");
                }
            }
        }
        private NokObjects.GetSeatsResultViewModel _GetSeatsResult;
        public NokObjects.GetSeatsResultViewModel GetSeatsResult
        {
            get
            {
                return _GetSeatsResult;
            }
            set
            {
                if (value != _GetSeatsResult)
                {
                    _GetSeatsResult = value;
                    NotifyPropertyChanged("GetSeatsResult");
                }
            }
        }

        private string _sampleProperty = "Sample Runtime Property Value";
        /// <summary>
        /// Sample ViewModel property; this property is used in the view to display its value using a Binding
        /// </summary>
        /// <returns></returns>
        public string SampleProperty
        {
            get
            {
                return _sampleProperty;
            }
            set
            {
                if (value != _sampleProperty)
                {
                    _sampleProperty = value;
                    NotifyPropertyChanged("SampleProperty");
                }
            }
        }
        #endregion

        #region Language
        private string _AboutNok = App.lang == "eng" ? "About Nok Air" : "เกี่ยวกับนกแอร์";
        public string AboutNok
        {
            get
            {
                return _AboutNok;
            }
            set
            {
                if (value != _AboutNok)
                {
                    _AboutNok = value;
                    NotifyPropertyChanged("AboutNok");
                }
            }
        }

        private string _paymentTitle = App.lang == "eng" ? "Payment Method" : "ช่องทางการชำระเงิน";
        public string PaymentTitle
        {
            get
            {
                return _paymentTitle;
            }
            set
            {
                if (value != _paymentTitle)
                {
                    _paymentTitle = value;
                    NotifyPropertyChanged("PaymentTitle");
                }
            }
        }

        private string _paymentMsg = App.lang == "eng" ? "Payment Method" : "ช่องทางการชำระเงิน";
        public string PaymentTMsg
        {
            get
            {
                return _paymentMsg;
            }
            set
            {
                if (value != _paymentMsg)
                {
                    _paymentMsg = value;
                    NotifyPropertyChanged("PaymentTMsg");
                }
            }
        }

        private string _paymentMsg2 = App.lang == "eng" ? "Please choose your payment method." : "กรุณาเลือกช่องทางการชำระเงินของท่าน";
        public string PaymentTMsg2
        {
            get
            {
                return _paymentMsg2;
            }
            set
            {
                if (value != _paymentMsg2)
                {
                    _paymentMsg2 = value;
                    NotifyPropertyChanged("PaymentTMsg2");
                }
            }
        }

        private string _paymentMsg3 = App.lang == "eng" ? "The payment is eligible for residents\r\nin Thailand only Are you living in Thailand?" : "การชำระเงินใช้ได้สำหรับลูกค้าที่พำนัก\r\nอยู่ภายในประเทศไทยเท่านั้น\r\nท่านอาศัยอยู่ในประเทศไทยใช่หรือไม่";
        public string PaymentTMsg3
        {
            get
            {
                return _paymentMsg3;
            }
            set
            {
                if (value != _paymentMsg3)
                {
                    _paymentMsg3 = value;
                    NotifyPropertyChanged("PaymentTMsg3");
                }
            }
        }

        private string _atm = App.lang == "eng" ? "ATM" : "เอทีเอ็ม";
        public string ATM
        {
            get
            {
                return _atm;
            }
            set
            {
                if (value != _atm)
                {
                    _atm = value;
                    NotifyPropertyChanged("ATM");
                }
            }
        }

        private string _counterService = App.lang == "eng" ? "Counter Service" : "เคาน์เตอร์ เซอร์วิส";
        public string CounterService
        {
            get
            {
                return _counterService;
            }
            set
            {
                if (value != _counterService)
                {
                    _counterService = value;
                    NotifyPropertyChanged("CounterService");
                }
            }
        }  private string _yes = App.lang == "eng" ? "Yes" : "ใช่";
        public string Yes
        {
            get
            {
                return _yes;
            }
            set
            {
                if (value != _yes)
                {
                    _yes = value;
                    NotifyPropertyChanged("Yes");
                }
            }
        }

        private string _no = App.lang == "eng" ? "No" : "ไม่ใช่";
        public string No
        {
            get
            {
                return _no;
            }
            set
            {
                if (value != _no)
                {
                    _no = value;
                    NotifyPropertyChanged("No");
                }
            }
        }

        private string _passengerInfoMsg = App.lang == "eng" ? "Please fill passenger's information." : "กรุณากรอกข้อมูลผู้โดยสาร";
        public string PassengerInfoMsg
        {
            get
            {
                return _passengerInfoMsg;
            }
            set
            {
                if (value != _passengerInfoMsg)
                {
                    _passengerInfoMsg = value;
                    NotifyPropertyChanged("PassengerInfoMsg");
                }
            }
        }
        private string _passengerInfoMsg2 = App.lang == "eng" ? "Please fill information in English only." : "กรุณากรอกข้อมูลเป็นภาษาอังกฤษเท่านั้น";
        public string PassengerInfoMsg2
        {
            get
            {
                return _passengerInfoMsg2;
            }
            set
            {
                if (value != _passengerInfoMsg2)
                {
                    _passengerInfoMsg2 = value;
                    NotifyPropertyChanged("PassengerInfoMsg2");
                }
            }
        }
        private string _contactInfoAdult = App.lang == "eng" ? "Adult(s) Information." : "ข้อมูลผู้โดยสาร ผู้ใหญ่";
        public string ContactInfoAdult
        {
            get
            {
                return _contactInfoAdult;
            }
            set
            {
                if (value != _contactInfoAdult)
                {
                    _contactInfoAdult = value;
                    NotifyPropertyChanged("ContactInfoAdult");
                }
            }
        }
        private string _contactInfoChild = App.lang == "eng" ? "Child(Children) Information." : "ข้อมูลผู้โดยสาร เด็ก";
        public string ContactInfoChild
        {
            get
            {
                return _contactInfoChild;
            }
            set
            {
                if (value != _contactInfoChild)
                {
                    _contactInfoChild = value;
                    NotifyPropertyChanged("ContactInfoChild");
                }
            }
        }


        private string _prefix = App.lang == "eng" ? "Prefix" : "คำนำหน้าชื่อ";
        public string Prefix
        {
            get
            {
                return _prefix;
            }
            set
            {
                if (value != _prefix)
                {
                    _prefix = value;
                    NotifyPropertyChanged("Prefix");
                }
            }
        } private string _firstName = App.lang == "eng" ? "First Name" : "ชื่อ";
        public string FirstName
        {
            get
            {
                return _firstName;
            }
            set
            {
                if (value != _firstName)
                {
                    _firstName = value;
                    NotifyPropertyChanged("FirstName");
                }
            }
        }
        private string _contactInfo = App.lang == "eng" ? "Contact Information" : "ข้อมูลสำหรับติดต่อ";
        public string ContactInfo
        {
            get
            {
                return _contactInfo;
            }
            set
            {
                if (value != _contactInfo)
                {
                    _contactInfo = value;
                    NotifyPropertyChanged("ContactInfo");
                }
            }
        }
        private string _country = App.lang == "eng" ? "Country" : "ประเทศ";
        public string Country
        {
            get
            {
                return _country;
            }
            set
            {
                if (value != _country)
                {
                    _country = value;
                    NotifyPropertyChanged("Country");
                }
            }
        }
        private string _phone = App.lang == "eng" ? "Phone" : "เบอร์บ้าน หรือที่ทำงาน";
        public string Phone
        {
            get
            {
                return _phone;
            }
            set
            {
                if (value != _phone)
                {
                    _phone = value;
                    NotifyPropertyChanged("Phone");
                }
            }
        }
        private string _mobilePhone = App.lang == "eng" ? "Mobile Phone" : "เบอร์มือถือ";
        public string MobilePhone
        {
            get
            {
                return _mobilePhone;
            }
            set
            {
                if (value != _mobilePhone)
                {
                    _mobilePhone = value;
                    NotifyPropertyChanged("MobilePhone");
                }
            }
        }
        private string _email = App.lang == "eng" ? "e-mail" : "อีเมล์";
        public string Email
        {
            get
            {
                return _email;
            }
            set
            {
                if (value != _email)
                {
                    _email = value;
                    NotifyPropertyChanged("Email");
                }
            }
        }

        private string _phoneNumberNotice = App.lang == "eng" ? "Please input 66 before your phone and mobile phone number\r\nFor example, if your mobile phone is 0891234567 Please input 66891234567\r\n\"SMS will be sent out to valid mobile number only\"" : "กรุณาใส่ 66 นำหน้าทั้งหมายเลขโทรศัพท์บ้านหรือที่ทำงาน\r\nและหมายเลขโทรศัพท์มือถือ\r\nเช่น ถ้าหมายเลขโทรศัพท์ของคุณคือ 0891234567\r\nกรุณาใส่เป็น 66891234567 \r\n\"SMS จะถูกส่งไปยังหมายเลขที่โทรศัพท์ที่ถูกต้องเท่านั้น\"";
        public string PhoneNumberNotice
        {
            get
            {
                return _phoneNumberNotice;
            }
            set
            {
                if (value != _phoneNumberNotice)
                {
                    _phoneNumberNotice = value;
                    NotifyPropertyChanged("PhoneNumberNotice");
                }
            }
        }
        private string _PaycodeNo = App.lang == "eng" ? "Pay code No." : "หมายเลขรหัสการชำระเงิน";
        public string PaycodeNo
        {
            get
            {
                return _PaycodeNo;
            }
            set
            {
                if (value != _PaycodeNo)
                {
                    _PaycodeNo = value;
                    NotifyPropertyChanged("PaycodeNo");
                }
            }
        }
        private string _Status = App.lang == "eng" ? "Status" : "สถานะ";
        public string Status
        {
            get
            {
                return _Status;
            }
            set
            {
                if (value != _Status)
                {
                    _Status = value;
                    NotifyPropertyChanged("Status");
                }
            }
        }   
        private string _ImportantNote = App.lang == "eng" ? "Important Note" : "หมายเหตุ";
        public string ImportantNote
        {
            get
            {
                return _ImportantNote;
            }
            set
            {
                if (value != _ImportantNote)
                {
                    _ImportantNote = value;
                    NotifyPropertyChanged("ImportantNote");
                }
            }
        }
        private string _ImportantNoteMsg = App.lang == "eng" ? "To complete the purchase, please use payment code to make \"CASH PAYMENT\" at Counter Service Plus in 7-Eleven" : "เพื่อให้การจองตั๋วเสร็จสมบูรณ์ โปรดกรุณานำหมายเลขรหัสการชำระเงิน ไปทำการชำระที่ เคาน์เตอร์ เซอร์วิส พลัส ใน 7-Eleven";
        public string ImportantNoteMsg
        {
            get
            {
                return _ImportantNoteMsg;
            }
            set
            {
                if (value != _ImportantNoteMsg)
                {
                    _ImportantNoteMsg = value;
                    NotifyPropertyChanged("ImportantNoteMsg");
                }
            }
        }
        private string _Within = App.lang == "eng" ? "Within" : "ภายใน";
        public string Within
        {
            get
            {
                return _Within;
            }
            set
            {
                if (value != _Within)
                {
                    _Within = value;
                    NotifyPropertyChanged("Within");
                }
            }
        }

        private string _checkinTitle = App.lang == "eng" ? "Check In" : "เช็คอิน";
        public string CheckinTitle
        {
            get
            {
                return _checkinTitle;
            }
            set
            {
                if (value != _checkinTitle)
                {
                    _checkinTitle = value;
                    NotifyPropertyChanged("CheckinTitle");
                }
            }
        }
        private string _continue = App.lang == "eng" ? "Continue" : "ทำต่อ";
        public string Continue
        {
            get
            {
                return _continue;
            }
            set
            {
                if (value != _continue)
                {
                    _continue = value;
                    NotifyPropertyChanged("Continue");
                }
            }
        }
        private string _done = App.lang == "eng" ? "Done" : "เสร็จสิ้น";
        public string Done
        {
            get
            {
                return _done;
            }
            set
            {
                if (value != _done)
                {
                    _done = value;
                    NotifyPropertyChanged("Done");
                }
            }
        }
        private string _ok = App.lang == "eng" ? "OK" : "ตกลง";
        public string OK
        {
            get
            {
                return _ok;
            }
            set
            {
                if (value != _ok)
                {
                    _ok = value;
                    NotifyPropertyChanged("OK");
                }
            }
        }
        private string _Save = App.lang == "eng" ? "Save" : "บันทึก";
        public string Save
        {
            get
            {
                return _Save;
            }
            set
            {
                if (value != _Save)
                {
                    _Save = value;
                    NotifyPropertyChanged("Save");
                }
            }
        }
        private string _SaveComplete = App.lang == "eng" ? "A screenshot is now saved at Media Library." : "ภาพ screenshot ถูกบันทึกไว้ที่คลังภาพเรียบร้อยแล้ว";
        public string SaveComplete
        {
            get
            {
                return _SaveComplete;
            }
            set
            {
                if (value != _SaveComplete)
                {
                    _SaveComplete = value;
                    NotifyPropertyChanged("SaveComplete");
                }
            }
        }
        private string _claer = App.lang == "eng" ? "Claer" : "ล้าง";
        public string Claer
        {
            get
            {
                return _claer;
            }
            set
            {
                if (value != _claer)
                {
                    _claer = value;
                    NotifyPropertyChanged("Claer");
                }
            }
        }
        private string _cancel = App.lang == "eng" ? "Cancel" : "ยกเลิก";
        public string Cancel
        {
            get
            {
                return _cancel;
            }
            set
            {
                if (value != _cancel)
                {
                    _cancel = value;
                    NotifyPropertyChanged("Cancel");
                }
            }
        }
        private string _next = App.lang == "eng" ? "Next" : "ต่อไป";
        public string Next
        {
            get
            {
                return _next;
            }
            set
            {
                if (value != _next)
                {
                    _next = value;
                    NotifyPropertyChanged("Next");
                }
            }
        }
        private string _checkinMsg = App.lang == "eng" ? "Sign in to Check In" : "เข้าสู่ระบบเพื่อทำการเช็คอิน";
        public string CheckinMsg
        {
            get
            {
                return _checkinMsg;
            }
            set
            {
                if (value != _checkinMsg)
                {
                    _checkinMsg = value;
                    NotifyPropertyChanged("CheckinMsg");
                }
            }
        }

        private string _bookingNum = App.lang == "eng" ? "Booking Number" : "หมายเลขการจอง";
        public string BookingNum
        {
            get
            {
                return _bookingNum;
            }
            set
            {
                if (value != _bookingNum)
                {
                    _bookingNum = value;
                    NotifyPropertyChanged("BookingNum");
                }
            }
        }

        private string _totalAmount = App.lang == "eng" ? "Total Amount" : "ราคาทั้งหมด";
        public string TotalAmount
        {
            get
            {
                return _totalAmount;
            }
            set
            {
                if (value != _totalAmount)
                {
                    _totalAmount = value;
                    NotifyPropertyChanged("TotalAmount");
                }
            }
        }

        private string _lastName = App.lang == "eng" ? "Last Name" : "นามสกุล";
        public string LastName
        {
            get
            {
                return _lastName;
            }
            set
            {
                if (value != _lastName)
                {
                    _lastName = value;
                    NotifyPropertyChanged("LastName");
                }
            }
        }

        private string _agreeMsg = App.lang == "eng" ? "I agree with your terms & condition" : "ข้าพเจ้าเข้าใจและยอมรับเงื่อนไขและข้อกำหนด";
        public string AgreeMsg
        {
            get
            {
                return _agreeMsg;
            }
            set
            {
                if (value != _agreeMsg)
                {
                    _agreeMsg = value;
                    NotifyPropertyChanged("AgreeMsg");
                }
            }
        }
        private string _selFlightTitle = App.lang == "eng" ? "Select Flight" : "เลือกเที่ยวบิน";
        public string SelFlightTitle
        {
            get
            {
                return _selFlightTitle;
            }
            set
            {
                if (value != _selFlightTitle)
                {
                    _selFlightTitle = value;
                    NotifyPropertyChanged("SelFlightTitle");
                }
            }
        }
        private string _selFlightMsg = App.lang == "eng" ? "Which flight would you like to check in?" : "เที่ยวบินใดที่ท่านต้องการเช็คอิน?";
        public string SelFlightMsg
        {
            get
            {
                return _selFlightMsg;
            }
            set
            {
                if (value != _selFlightMsg)
                {
                    _selFlightMsg = value;
                    NotifyPropertyChanged("SelFlightMsg");
                }
            }
        }

        private string _selSeatTitle = App.lang == "eng" ? "Select Seat" : "เลือกที่นั่ง";
        public string SelSeatTitle
        {
            get
            {
                return _selSeatTitle;
            }
            set
            {
                if (value != _selSeatTitle)
                {
                    _selSeatTitle = value;
                    NotifyPropertyChanged("SelSeatTitle");
                }
            }
        }
        private string _selSeatMsg = App.lang == "eng" ? "Which passenger would you like to check in?" : "ผู้โดยสารคนไหนที่ท่านต้องการเช็คอิน";
        public string SelSeatMsg
        {
            get
            {
                return _selSeatMsg;
            }
            set
            {
                if (value != _selSeatMsg)
                {
                    _selSeatMsg = value;
                    NotifyPropertyChanged("SelSeatMsg");
                }
            }
        }
        private string _seatNo = App.lang == "eng" ? "Seat No." : "เลขที่นั่ง";
        public string SeatNo
        {
            get
            {
                return _seatNo;
            }
            set
            {
                if (value != _seatNo)
                {
                    _seatNo = value;
                    NotifyPropertyChanged("SeatNo");
                }
            }
        }
        private string _passenger = App.lang == "eng" ? "Passenger" : "ผู้โดยสาร";
        public string Passenger
        {
            get
            {
                return _passenger;
            }
            set
            {
                if (value != _passenger)
                {
                    _passenger = value;
                    NotifyPropertyChanged("Passenger");
                }
            }
        }
        private string _passengerName = App.lang == "eng" ? "Passenger Name" : "ชื่อผู้โดยสาร";
        public string PassengerName
        {
            get
            {
                return _passengerName;
            }
            set
            {
                if (value != _passengerName)
                {
                    _passengerName = value;
                    NotifyPropertyChanged("PassengerName");
                }
            }
        }
        private string _CheckInSeqStr = App.lang == "eng" ? "Seq No." : "ลำดับการเช็คอิน";
        public string CheckInSeqStr
        {
            get
            {
                return _CheckInSeqStr;
            }
            set
            {
                if (value != _CheckInSeqStr)
                {
                    _CheckInSeqStr = value;
                    NotifyPropertyChanged("CheckInSeqStr");
                }
            }
        }
        private string _BoardingTimeStr = App.lang == "eng" ? "Boarding Time" : "เวลาเรียกขึ้นเครื่อง";
        public string BoardingTimeStr
        {
            get
            {
                return _BoardingTimeStr;
            }
            set
            {
                if (value != _BoardingTimeStr)
                {
                    _BoardingTimeStr = value;
                    NotifyPropertyChanged("BoardingTimeStr");
                }
            }
        }
        private string _boardingPassTitle = App.lang == "eng" ? "Boarding Pass" : "บัตรขึ้นเครื่อง";
        public string BoardingPassTitle
        {
            get
            {
                return _boardingPassTitle;
            }
            set
            {
                if (value != _boardingPassTitle)
                {
                    _boardingPassTitle = value;
                    NotifyPropertyChanged("BoardingPassTitle");
                }
            }
        }
        private string _boardingPassMsg = App.lang == "eng" ? "successfully completed" : "เสร็จสิ้นสมบูรณ์";
        public string BoardingPassMsg
        {
            get
            {
                return _boardingPassMsg;
            }
            set
            {
                if (value != _boardingPassMsg)
                {
                    _boardingPassMsg = value;
                    NotifyPropertyChanged("BoardingPassMsg");
                }
            }
        }
        private string _boardingPassAlertMsg = App.lang == "eng" ? "Your check-in is successfully completed. Your Boarding Pass has been saved to Media Library. You can also view your Boarding Pass by tapping on checked in passenger. Thank you for choosing Nok Airlines. We wish you a very pleasant flight." : "การเช็คอินของท่านสำเร็จ ระบบได้ทำการบันทึก Boarding Pass ไว้ที่คลังภาพแล้ว ท่านสามารถดู Boarding Pass โดยการกดที่ผู้โดยสารที่ต้องการ ขอขอบคุณที่เลือกใช้บริการสายการบินนกแอร์";
        public string BoardingPassAlertMsg
        {
            get
            {
                return _boardingPassAlertMsg;
            }
            set
            {
                if (value != _boardingPassAlertMsg)
                {
                    _boardingPassAlertMsg = value;
                    NotifyPropertyChanged("BoardingPassAlertMsg");
                }
            }
        }
        private string _BookingFinishAlertMsg = App.lang == "eng" ? "You've already book flight. Your Booking info has been saved to Media Library. You can also view in Media Library. It's named to \"NokAirBookingNo_" : "คุณได้ทำการจองตั๋วเสร็จสิ้นสมบูรณ์แล้ว ข้อมูลการจองถูกบันทึกลงคลังสื่อมัลติมีเดีย โดยคุณสามารถเข้าไปตรวจดูได้ที่ชื่อ \"NokAirBookingNo_";
        public string BookingFinishAlertMsg
        {
            get
            {
                return _BookingFinishAlertMsg;
            }
            set
            {
                if (value != _BookingFinishAlertMsg)
                {
                    _BookingFinishAlertMsg = value;
                    NotifyPropertyChanged("BookingFinishAlertMsg");
                }
            }
        }
        private string _flightSheduleTitle = App.lang == "eng" ? "Flight Schedule" : "ตารางเที่ยวบิน";
        public string FlightSheduleTitle
        {
            get
            {
                return _flightSheduleTitle;
            }
            set
            {
                if (value != _flightSheduleTitle)
                {
                    _flightSheduleTitle = value;
                    NotifyPropertyChanged("FlightSheduleTitle");
                }
            }
        }
        private string _from = App.lang == "eng" ? "From" : "จาก";
        public string From
        {
            get
            {
                return _from;
            }
            set
            {
                if (value != _from)
                {
                    _from = value;
                    NotifyPropertyChanged("From");
                }
            }
        }
        private string _to = App.lang == "eng" ? "To" : "ถึง";
        public string To
        {
            get
            {
                return _to;
            }
            set
            {
                if (value != _to)
                {
                    _to = value;
                    NotifyPropertyChanged("To");
                }
            }
        }
        private string _date = App.lang == "eng" ? "Date" : "วันที่";
        public string Date
        {
            get
            {
                return _date;
            }
            set
            {
                if (value != _date)
                {
                    _date = value;
                    NotifyPropertyChanged("Date");
                }
            }
        }
        private string _dep = App.lang == "eng" ? "Dep." : "ออก";
        public string Dep
        {
            get
            {
                return _dep;
            }
            set
            {
                if (value != _dep)
                {
                    _dep = value;
                    NotifyPropertyChanged("Dep");
                }
            }
        }
        private string _arr = App.lang == "eng" ? "Arr." : "ถึง";
        public string Arr
        {
            get
            {
                return _arr;
            }
            set
            {
                if (value != _arr)
                {
                    _arr = value;
                    NotifyPropertyChanged("Arr");
                }
            }
        }
        private string _flightNo = App.lang == "eng" ? "Flight" : "เที่ยวบิน";
        public string FlightNo
        {
            get
            {
                return _flightNo;
            }
            set
            {
                if (value != _flightNo)
                {
                    _flightNo = value;
                    NotifyPropertyChanged("FlightNo");
                }
            }
        }
        private string _class = App.lang == "eng" ? "Class" : "ชั้น";
        public string Class
        {
            get
            {
                return _class;
            }
            set
            {
                if (value != _class)
                {
                    _class = value;
                    NotifyPropertyChanged("Class");
                }
            }
        }
        private string _view = App.lang == "eng" ? "View" : "ดู";
        public string View
        {
            get
            {
                return _view;
            }
            set
            {
                if (value != _view)
                {
                    _view = value;
                    NotifyPropertyChanged("View");
                }
            }
        }
        private string _bookFlightTitle = App.lang == "eng" ? "Book Flight" : "จองตั๋ว";
        public string BookFlightTitle
        {
            get
            {
                return _bookFlightTitle;
            }
            set
            {
                if (value != _bookFlightTitle)
                {
                    _bookFlightTitle = value;
                    NotifyPropertyChanged("BookFlightTitle");
                }
            }
        }
        private string _oneWay = App.lang == "eng" ? "One Way" : "เที่ยวเดียว";
        public string OneWay
        {
            get
            {
                return _oneWay;
            }
            set
            {
                if (value != _oneWay)
                {
                    _oneWay = value;
                    NotifyPropertyChanged("OneWay");
                }
            }
        }
        private string _roundTrip = App.lang == "eng" ? "Round Trip" : "ไปกลับ";
        public string RoundTrip
        {
            get
            {
                return _roundTrip;
            }
            set
            {
                if (value != _roundTrip)
                {
                    _roundTrip = value;
                    NotifyPropertyChanged("RoundTrip");
                }
            }
        }
        private string _depart = App.lang == "eng" ? "Depart" : "ออกเดินทาง";
        public string Depart
        {
            get
            {
                return _depart;
            }
            set
            {
                if (value != _depart)
                {
                    _depart = value;
                    NotifyPropertyChanged("Depart");
                }
            }
        }
        private string _time = App.lang == "eng" ? "Time" : "เวลา";
        public string Time
        {
            get
            {
                return _time;
            }
            set
            {
                if (value != _time)
                {
                    _time = value;
                    NotifyPropertyChanged("Time");
                }
            }
        }
        private string _return = App.lang == "eng" ? "Return" : "เดินทางกลับ";
        public string Return
        {
            get
            {
                return _return;
            }
            set
            {
                if (value != _return)
                {
                    _return = value;
                    NotifyPropertyChanged("Return");
                }
            }
        }
        private string _depart2 = App.lang == "eng" ? "Depart" : "เที่ยวไป";
        public string Depart2
        {
            get
            {
                return _depart2;
            }
            set
            {
                if (value != _depart2)
                {
                    _depart2 = value;
                    NotifyPropertyChanged("Depart2");
                }
            }
        }
        private string _return2 = App.lang == "eng" ? "Return" : "เที่ยวกลับ";
        public string Return2
        {
            get
            {
                return _return2;
            }
            set
            {
                if (value != _return2)
                {
                    _return2 = value;
                    NotifyPropertyChanged("Return2");
                }
            }
        }
        private string _adult = App.lang == "eng" ? "Adult" : "ผู้ใหญ่";
        public string Adult
        {
            get
            {
                return _adult;
            }
            set
            {
                if (value != _adult)
                {
                    _adult = value;
                    NotifyPropertyChanged("Adult");
                }
            }
        }
        private string _children = App.lang == "eng" ? "Children" : "เด็ก";
        public string Children
        {
            get
            {
                return _children;
            }
            set
            {
                if (value != _children)
                {
                    _children = value;
                    NotifyPropertyChanged("Children");
                }
            }
        }
        private string _viewBookingTitle = App.lang == "eng" ? "View Booking" : "ดูข้อมูลการจอง";
        public string ViewBookingTitle
        {
            get
            {
                return _viewBookingTitle;
            }
            set
            {
                if (value != _viewBookingTitle)
                {
                    _viewBookingTitle = value;
                    NotifyPropertyChanged("ViewBookingTitle");
                }
            }
        }
        private string _viewBookingMsg = App.lang == "eng" ? "Please sign in\r\nto view your booking" : "เข้าสู่ระบบ\r\nเพื่อดูข้อมูลการจอง";
        public string ViewBookingMsg
        {
            get
            {
                return _viewBookingMsg;
            }
            set
            {
                if (value != _viewBookingMsg)
                {
                    _viewBookingMsg = value;
                    NotifyPropertyChanged("ViewBookingMsg");
                }
            }
        }
        private string _thanksMsg1 = App.lang == "eng" ? "Thank you" : "ขอบคุณ";
        public string ThanksMsg1
        {
            get
            {
                return _thanksMsg1;
            }
            set
            {
                if (value != _thanksMsg1)
                {
                    _thanksMsg1 = value;
                    NotifyPropertyChanged("ThanksMsg1");
                }
            }
        }
        private string _thanksMsg2 = App.lang == "eng" ? "for choosing Nok Air." : "ที่เลือกใช้สายการบินนกเแอร์";
        public string ThanksMsg2
        {
            get
            {
                return _thanksMsg2;
            }
            set
            {
                if (value != _thanksMsg2)
                {
                    _thanksMsg2 = value;
                    NotifyPropertyChanged("ThanksMsg2");
                }
            }
        }
        private string _nokEco = App.lang == "eng" ? "Nok Eco" : "นกประหยัด";
        public string NokEco
        {
            get
            {
                return _nokEco;
            }
            set
            {
                if (value != _nokEco)
                {
                    _nokEco = value;
                    NotifyPropertyChanged("NokEco");
                }
            }
        }
        private string _nokFlexi = App.lang == "eng" ? "Nok Flexi" : "นกเปลี่ยนได้";
        public string NokFlexi
        {
            get
            {
                return _nokFlexi;
            }
            set
            {
                if (value != _nokFlexi)
                {
                    _nokFlexi = value;
                    NotifyPropertyChanged("NokFlexi");
                }
            }
        }
        private string _nokPlus = App.lang == "eng" ? "Nok Plus" : "นกพลัส";
        public string NokPlus
        {
            get
            {
                return _nokPlus;
            }
            set
            {
                if (value != _nokPlus)
                {
                    _nokPlus = value;
                    NotifyPropertyChanged("NokPlus");
                }
            }
        }
        private string _moneyUnit = App.lang == "eng" ? "THB." : "บาท";
        public string MoneyUnit
        {
            get
            {
                return _moneyUnit;
            }
            set
            {
                if (value != _moneyUnit)
                {
                    _moneyUnit = value;
                    NotifyPropertyChanged("MoneyUnit");
                }
            }
        }
        private string _fee = App.lang == "eng" ? "Fee" : "ค่าธรรมเนียม";
        public string Fee
        {
            get
            {
                return _fee;
            }
            set
            {
                if (value != _fee)
                {
                    _fee = value;
                    NotifyPropertyChanged("Fee");
                }
            }
        }
        private string _CheckinStatusN = App.lang == "eng" ? "Seat Selected. Ready for check in." : "เลือกที่นั่งแล้ว พร้อมสำหรับการเช็คอิน";
        public string CheckinStatusN
        {
            get
            {
                return _CheckinStatusN;
            }
            set
            {
                if (value != _CheckinStatusN)
                {
                    _CheckinStatusN = value;
                    NotifyPropertyChanged("CheckinStatusN");
                }
            }
        }
        private string _CheckinStatusNS = App.lang == "eng" ? "No Seat Selected. Please select a seat." : "ยังไม่เลือกที่นั่ง กรุณาเลือกที่นั่ง";
        public string CheckinStatusNS
        {
            get
            {
                return _CheckinStatusNS;
            }
            set
            {
                if (value != _CheckinStatusNS)
                {
                    _CheckinStatusNS = value;
                    NotifyPropertyChanged("CheckinStatusNS");
                }
            }
        }
        private string _CheckinStatusY = App.lang == "eng" ? "Complete. Already checked in." : "เช็คอินสำเร็จแล้ว";
        public string CheckinStatusY
        {
            get
            {
                return _CheckinStatusY;
            }
            set
            {
                if (value != _CheckinStatusY)
                {
                    _CheckinStatusY = value;
                    NotifyPropertyChanged("CheckinStatusY");
                }
            }
        }
        
        private string _fillFormErrMsg = App.lang == "eng" ? "Please complete the form before continue." : "กรุณากรอกข้อมูลให้ครบถ้วน";
        public string FillFormErrorMsg
        {
            get
            {
                return _fillFormErrMsg;
            }
            set
            {
                if (value != _fillFormErrMsg)
                {
                    _fillFormErrMsg = value;
                    NotifyPropertyChanged("FillFormErrorMsg");
                }
            }
        }
        private string _agreeErrMsg = App.lang == "eng" ? "Please Agree Terms & Conditions before continue." : "กรุณายอมรับเงื่อนไขและข้อตกลงก่อนทำรายการต่อ";
        public string AgreeErrorMsg
        {
            get
            {
                return _agreeErrMsg;
            }
            set
            {
                if (value != _agreeErrMsg)
                {
                    _agreeErrMsg = value;
                    NotifyPropertyChanged("AgreeErrorMsg");
                }
            }
        }
        private string _dateTimeErrorMsg = App.lang == "eng" ? "This is not a valid date for this flight." : "กรุณาเลือกวันเวลาให้ถูกต้อง";
        public string DateTimeErrorMsg
        {
            get
            {
                return _dateTimeErrorMsg;
            }
            set
            {
                if (value != _dateTimeErrorMsg)
                {
                    _dateTimeErrorMsg = value;
                    NotifyPropertyChanged("DateTimeErrorMsg");
                }
            }
        }
        private string _7kilosMsg = App.lang == "eng" ? "This is available only for\r\nless than 7 kilograms luggage." : "บริการนี้สำหรับผู้โดยสารที่\r\nมีสัมภาระถือขึ้นเครื่องไม่เกิน 7 กก. เท่านั้น";
        public string SevenKilosMsg
        {
            get
            {
                return _7kilosMsg;
            }
            set
            {
                if (value != _7kilosMsg)
                {
                    _7kilosMsg = value;
                    NotifyPropertyChanged("SevenKilosMsg");
                }
            }
        }

        private string _termsURL = "http://www.nokair.com/s1000_obj/contents/mobile/termsmobile_" + (App.lang == "eng" ? "en" : "th") + ".html";
        public string TermsURL
        {
            get
            {
                return _termsURL;
            }
            set
            {
                if (value != _termsURL)
                {
                    _7kilosMsg = value;
                    NotifyPropertyChanged("TermsURL");
                }
            }
        }

        private string _termsTitle = App.lang == "eng" ? "Terms & Condition" : "เงื่อนไขและข้อตกลง";
        public string TermsTitle
        {
            get
            {
                return _termsTitle;
            }
            set
            {
                if (value != _termsTitle)
                {
                    _termsTitle = value;
                    NotifyPropertyChanged("TermsTitle");
                }
            }
        }

        private string _acceptText = App.lang == "eng" ? "Accept" : "ยอมรับ";
        public string AcceptText
        {
            get
            {
                return _acceptText;
            }
            set
            {
                if (value != _acceptText)
                {
                    _acceptText = value;
                    NotifyPropertyChanged("AcceptText");
                }
            }
        }
        
        private string _declineText = App.lang == "eng" ? "Decline" : "ไม่ยอมรับ";
        public string DeclineText
        {
            get
            {
                return _declineText;
            }
            set
            {
                if (value != _declineText)
                {
                    _declineText = value;
                    NotifyPropertyChanged("DeclineText");
                }
            }
        }

        private string _noflights = App.lang == "eng" ? "No Flights Available." : "ไม่มีเที่ยวบิน";
        public string NoFlights
        {
            get
            {
                return _noflights;
            }
            set
            {
                if (value != _noflights)
                {
                    _noflights = value;
                    NotifyPropertyChanged("NoFlights");
                }
            }
        }

        private string _confirmTitle = App.lang == "eng" ? "Confirmation" : "ยืนยันการจอง";
        public string ConfirmTitle
        {
            get
            {
                return _confirmTitle;
            }
            set
            {
                if (value != _confirmTitle)
                {
                    _confirmTitle = value;
                    NotifyPropertyChanged("ConfirmTitle");
                }
            }
        }
        #endregion

        public bool IsDataLoaded
        {
            get;
            private set;
        }

        /// <summary>
        /// Creates and adds a few ItemViewModel objects into the Items collection.
        /// </summary>
        public void LoadData()
        {
            FirstPageMenu fpm = new Wording().fpm;
            // Sample data; replace with real data
            this.MenuItem.Add(new NokObjects.MenuItemViewModel() { MenuTitle = fpm.CheckIn, MenuTag = "Check In", MenuIcon = "/Images/MenuIcon.png" });
            this.MenuItem.Add(new NokObjects.MenuItemViewModel() { MenuTitle = fpm.FlightSch, MenuTag = "Flight Schedule", MenuIcon = "/Images/MenuIcon.png" });
            this.MenuItem.Add(new NokObjects.MenuItemViewModel() { MenuTitle = fpm.BookFlight, MenuTag = "Book Flight", MenuIcon = "/Images/MenuIcon.png" });
            this.MenuItem.Add(new NokObjects.MenuItemViewModel() { MenuTitle = fpm.ViewBooking, MenuTag = "View Booking", MenuIcon = "/Images/MenuIcon.png" });


            //http://forums.silverlight.net/forums/t/212398.aspx => how to read xml
            XDocument airports = XDocument.Load("AirPortInfo.xml");

            foreach (XElement airport in airports.Descendants("airport")) {
                string name = airport.Element("name").Element(App.lang).Value;
                name = name.Replace("\\n", "\r\n");
                this.AirportItems.Add(new NokObjects.AirportItem
                     {
                         AirPortName = name,
                         AirPortLocation = airport.Element("province").Element(App.lang).Value,
                         AirPortIcon = "/Images/Airport/" + airport.Element("image").Value,
                         AirPortLat = airport.Element("location").Element("lat").Value,
                         AirPortLon = airport.Element("location").Element("lon").Value,
                         AirPortPhone = airport.Element("contract").Element("phone").Value,
                         AirPortPhoneName = (App.lang == "eng" ? "NokAir's " : "นกแอร์ ") + airport.Element("name").Element(App.lang).Value + " Call Center"
                     });
            }
            /*


            var airportItems = (from airport in airports.Descendants("airport")
                     select new ViewModels.AirportItemViewModel
                     {
                         AirPortName = airport.Element("name").Element(App.lang).Value,
                         AirPortLocat = airport.Element("province").Element(App.lang).Value,
                         AirPortIcon = "/Images/Airport/" + airport.Element("image").Value,
                         AirPortLat = airport.Element("location").Element("lat").Value,
                         AirPortLon = airport.Element("location").Element("lon").Value,
                         AirPortPhone = airport.Element("contract").Element("phone").Value,
                         AirPortPhoneName = (App.lang == "eng" ? "NokAir's " : "นกแอร์ ") + airport.Element("name").Element(App.lang).Value + " Call Center"
                     });
            foreach (ViewModels.AirportItemViewModel airportItem in airportItems)
            {
                this.AirportItems.Add(airportItem);
            }
            */
          

            this.IsDataLoaded = true;
        }

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}